﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Documents;

namespace DemoSupport
{
	public class BindableRun : Run
	{
		public static readonly DependencyProperty BindableTextProperty = DependencyProperty.Register("BindableText",
			typeof(string),
			typeof(BindableRun),
			new FrameworkPropertyMetadata(BindableText_Changed));

		public string BindableText
		{
			get
			{
				return GetValue(BindableTextProperty) as string;
			}
			set
			{
				SetValue(BindableTextProperty, value);
			}
		}

		private static void BindableText_Changed(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
		{
			BindableRun bindableRun = dependencyObject as BindableRun;
			bindableRun.Text = e.NewValue as string;
		}
	}
}
